//---------------------------------------------------------------------------
#include "TranslateUZ.h"

using namespace std;
#pragma hdrstop


#define COMPARE( A )  if (0 == memcmp( pCom, #A, 2 ) ) \
{                                                      \
    lCommands.push_back( new A (pCom, &count ) );      \
}

TranslateUZ::TranslateUZ( TCode code, TypeUZ type, UZ_Data * data )
{
	Code = code;
	Type = type;
	pData = data;
    pFirstCom = pData+2;
    int nSize = Size();
    UZ_Data * pCom = pFirstCom;

    while (nSize > 0)
    {
        int count = 1;
        char* pCh =  (char*)pCom;

        COMPARE( RZ );
        COMPARE( MP );
        COMPARE( VP );
        COMPARE( RT );
        COMPARE( CR );
        COMPARE( DG );
        COMPARE( DU );
        COMPARE( OB );
        COMPARE( OE );
        COMPARE( GB );
        COMPARE( CV );
        COMPARE( LU );
        COMPARE( LT );
        COMPARE( IT );
        COMPARE( PD );
        COMPARE( ND );
        COMPARE( DP );
        COMPARE( DZ );
        COMPARE( DO );
     //   COMPARE( BZ );
        COMPARE( EZ );
        COMPARE( VS );
        COMPARE( GL );
        COMPARE( TC );
        COMPARE( TL );
        COMPARE( GR );
        COMPARE( TT );
        COMPARE( MT );
        COMPARE( OT );
        COMPARE( TP );
        COMPARE( TO );
        COMPARE( OU );
        COMPARE( RP );
        COMPARE( RO );
        COMPARE( TM );
        COMPARE( KG );
        COMPARE( SH );
        COMPARE( HS );
        COMPARE( HD );
        COMPARE( SK );
        COMPARE( KK );
        COMPARE( KN );

         pCom += count;
         nSize-=count;

     }

}

TranslateUZ::~TranslateUZ()
{
}
AnsiString TranslateUZ::GetText()
{
    AnsiString asText = "";
    for ( Iter = lCommands.begin( ); Iter != lCommands.end( ); Iter++ )
    {
        asText += ((CommandBase*)(*Iter))->GetText();
    }

    return asText;


}
//---------------------------------------------------------------------------

#pragma package(smart_init)
